package org.example.ch02.service;

import org.apache.ibatis.session.SqlSession;
import org.example.ch02.entity.User;
import org.example.ch02.mapper.UserMapper;
import org.example.ch02.util.MybatisUtils;

/**
 * ClassName: UserService
 * Description:
 *
 * @Author zjl
 * @Create 2025/04/23 08:44
 * @Version 1.0
 */
public class UserService {

    public void save(User user) {
        try (SqlSession session = MybatisUtils.getSqlSession()) {
            UserMapper proxy = session.getMapper(UserMapper.class);
            proxy.save(user);
        }
    }
}
